﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jhong.FunMVC
{
    public class JsonResult : ActionResult
    {
        public override void Execute()
        {
            this._response.ContentType = @"application/json;charset=utf-8";
            var jsonStr = JsonConvert.SerializeObject(this._data);
            this._response.Write(jsonStr);
        }

        public JsonResult(object data, Response reponse)
        {
            this._data = data;
            this._response = reponse;
        }

        private Response _response;
        private object _data;
    }
}
